-
-
Notifications
You must be signed in to change notification settings - Fork 5
SF-3532 Dispose realtime docs when no longer in use #3199
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
abf739b
to
db6ad5d
Compare
9fcd8f8
to
74cce2c
Compare
e689f5d
to
9d7185b
Compare
e689f5d
to
7842d29
Compare
7842d29
to
b990402
Compare
5a61ab3
to
89e0fd9
Compare
89e0fd9
to
d59fd6c
Compare
Hello @Nateowami , Thank you for your work on this! Here are some comments on the code. I find positive names to be easier to understand than negative names, when using boolean logic. I suggest to consider renaming Can you explain more about the use of Rather than provide DocSubscription.unsubscribe for situations where a DestroyRef|Observable was not provided to DocSubscription.constructor, do you think we could always require clients to do one of
It looks like if we removed DocSubscription.unsubscribe, and instead had clients pass an Observable, that might look something like // New client field
private readonly bye$ = new Subject<void>();
...
// Pass in constructor
new DocSubscription('DraftGenerationStepsComponent', this.bye$.asObservable())
...
// New client method
wave(): void {
this.bye$.next();
this.bye$.complete();
} I want to mention that we could further reduce the complexity of DocSubscription by changing the constructor destroyRef argument from new DocSubscription('DraftGenerationStepsComponent', this.destroyRef) to something like new DocSubscription('DraftGenerationStepsComponent', new Observable(subscriber => this.destroyRef.onDestroy(() => subscriber.next()))) That makes the client code more complex just to simplify DocSubscription.constructor by a couple lines, so I'm not too inclined toward it. But I wanted to mention that idea in case it inspires other ideas. Sometimes when working in TypeScript it seems like it could be useful to have a standard disposable system. In C#, there is an IDisposable interface, and implementing classes have a
In C#, the IDisposal.dispose method is automatically called if you are |
2a921bc
to
52e5564
Compare
@Nateowami Okay, we have a clean run of unit tests and e2e tests. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Nateowami reviewed 6 of 132 files at r1, 1 of 9 files at r2, 3 of 3 files at r3.
Reviewable status: 10 of 136 files reviewed, 5 unresolved discussions
src/SIL.XForge.Scripture/ClientApp/e2e/await-application-startup.mts
line 7 at r3 (raw file):
const pollUrl = 'http://localhost:5000/projects'; const pollInterval = 17000;
This is already its own PR, so shouldn't be here.
src/SIL.XForge.Scripture/ClientApp/src/app/app.component.spec.ts
line 133 at r3 (raw file):
await env.navigate(['/projects', 'project01']); flush(); env.init();
Should calling flush()
be part of env.init()
? Or would that not be a good option?
src/SIL.XForge.Scripture/ClientApp/e2e/test_characterization.json
line 12 at r3 (raw file):
"generate_draft": { "success": 1, "failure": 100
I'm guessing these failures are no longer happening? If so this should be reverted.
src/SIL.XForge.Scripture/ClientApp/e2e/presets.ts
line 75 at r3 (raw file):
showArrow: true, outputDir: 'test_output/ci_e2e_test_results', maxTries: 50
Why was this changed?
src/SIL.XForge.Scripture/ClientApp/e2e/workflows/community-checking.ts
line 177 at r3 (raw file):
await page.waitForTimeout(500); } catch (e) { await page.pause();
This should only pause if preset.pauseOnFailure === true
26f7abc
to
7d436d6
Compare
7d436d6
to
979d64e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 5 of 136 files reviewed, 5 unresolved discussions (waiting on @Nateowami)
src/SIL.XForge.Scripture/ClientApp/e2e/workflows/community-checking.ts
line 177 at r3 (raw file):
Previously, Nateowami wrote…
This should only pause if
preset.pauseOnFailure === true
Fixed.
src/SIL.XForge.Scripture/ClientApp/src/app/app.component.spec.ts
line 133 at r3 (raw file):
Previously, Nateowami wrote…
Should calling
flush()
be part ofenv.init()
? Or would that not be a good option?
I did have blocks of
await env.init();
flush();
, possibly from thinking the flush()
might help make sure the await ...
completed. But it looks like tests are fine without it. I removed a bunch of flush()
after init
.
The particular place where your comment is located does benefit from a flush after env.navigate does ngZone.run, but I have moved the flush to inside navigate().
src/SIL.XForge.Scripture/ClientApp/e2e/await-application-startup.mts
line 7 at r3 (raw file):
Previously, Nateowami wrote…
This is already its own PR, so shouldn't be here.
Removed.
src/SIL.XForge.Scripture/ClientApp/e2e/presets.ts
line 75 at r3 (raw file):
Previously, Nateowami wrote…
Why was this changed?
To see if an e2e test would eventually pass, but it quickly passed when I tried. Reverted.
src/SIL.XForge.Scripture/ClientApp/e2e/test_characterization.json
line 12 at r3 (raw file):
Previously, Nateowami wrote…
I'm guessing these failures are no longer happening? If so this should be reverted.
Reverted.
979d64e
to
af09d77
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your changes. I don't have time to review this the rest of the way now, but I'm resolving my earlier comments.
@Nateowami reviewed 6 of 132 files at r1, 4 of 17 files at r4, 1 of 1 files at r5, all commit messages.
Reviewable status: 16 of 136 files reviewed, all discussions resolved (waiting on @marksvc)
I am doing some more review of the PR before marking as 'Ready for review'. |
This is still work in progress, but I want to put it out here as it appears to be working.
This change is